import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

// 使用 cnpm install指令下载
import ElementPlus from 'element-plus'         //element-plus 引入
import 'element-plus/dist/index.css'           //element-plus 引入
import '@/assets/icon/iconfont.css'            //引入图标
import '@/assets/base.scss'                    // import '@/assets/base.scss'
//引入cookies
import VueCookies from 'vue-cookies'
//引入代码高亮（/components/preview/PreviewTxt.vue中使用）
import HljsVuePlugin from '@highlightjs/vue-plugin'
import "highlight.js/styles/atom-one-light.css";
import "highlight.js/lib/common"

import Dialog from '@/components/Dialog.vue'    //引入自定义组件，弹窗的封装
import Verify from '@/utils/Verify'             //正则表达式
import Message from '@/utils/Message'           //消息封装
import Request from '@/utils/Request'           //axios的封装
import Avatar from '@/components/Avatar.vue'    //引入自定义组件，头像显示
import Confirm from '@/utils/Confirm'           //提示弹窗
import Table from '@/components/Table.vue'      //引入自定义组件，文件列表显示
import Icon from '@/components/Icon.vue'        //引入自定义组件，文件列表图标选择
import Utils from '@/utils/Utils'               //单位转换：字节 转 KB、MB、GB
import NoData from '@/components/NoData.vue'    //无下载文件时，下载区域的提示
import FolderSelect from '@/components/FolderSelect.vue' //批量移动按钮弹窗
import Navigation from '@/components/Navigation.vue'     //导航
import Preview from '@/components/preview/Preview.vue'   //文件预览
import Window from '@/components/Window.vue'             //视频预览

const app = createApp(App)   //创建App.vue对象（第二行）
//第15行 和 19行之间写组件的全局注册
app.use(ElementPlus)                               //element-plus组件全局注册
app.use(router)                                    //路由组件全局注册
app.use(HljsVuePlugin)

app.component("Dialog", Dialog);                   //可直接使用标签
app.component("Avatar", Avatar);
app.component("Table", Table);
app.component("Icon", Icon);
app.component("NoData", NoData);
app.component("FolderSelect", FolderSelect);
app.component("Navigation", Navigation);
app.component("Preview", Preview);
app.component("Window", Window);


app.config.globalProperties.Verify = Verify;        //配置全局变量
app.config.globalProperties.Message = Message;      //配置全局组件
app.config.globalProperties.Request = Request;      //配置全局组件
app.config.globalProperties.VueCookies = VueCookies;//配置全局组件
app.config.globalProperties.Confirm = Confirm;      //配置全局组件
app.config.globalProperties.Utils = Utils;          //配置全局组件

app.config.globalProperties.globalInfo = {          //全局变量
    avatarUrl: "http://localhost:7090/api/getAvatar/",    //请求用户头像 Avatar.vue -- 12行中有使用
    imageUrl: "/api/file/getImage/"                       //请求图片 Icon.vue -- 47行中有使用
};

app.mount('#app')   //进行挂载，挂载到index.html的<div id="app">中


//createApp(App).mount('#app')
